angular.module("app").run(["$rootScope", function($rootScope) {
    if(location.host.indexOf("localhost") >= 0){
        $rootScope.sysOrigin = "http://test.dakaqi.cn:9082";
    }
    else{
        $rootScope.sysOrigin = "/admin";
    }
    $rootScope.$on("$stateChangeStart", function (event, toState, toParams, fromState, fromParams) {
        if(toState.name.indexOf("home") >= 0 && !sessionStorage.userInfo){
            event.preventDefault();
            location.href = "#/login";
        }
    })
}]);